package com.deodar.system.service.impl;

import com.deodar.common.annotation.DataSource;
import com.deodar.common.enums.DataSourceType;
import com.deodar.system.domain.WebsiteInfo;
import com.deodar.system.mapper.WebsiteInfoMapper;
import com.deodar.system.service.IWebsiteInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@DataSource(value = DataSourceType.SLAVE)
@Service
public class WebsiteInfoServiceImpl implements IWebsiteInfoService {
    @Resource
    private WebsiteInfoMapper websiteInfoMapper;
    @Override
    public List<WebsiteInfo> findByPripid(String pripid) {
        List<WebsiteInfo> websiteInfos = websiteInfoMapper.selectByPripid(pripid);
        for(WebsiteInfo info : websiteInfos){
            info.setHaswebsite("1");
        }
        return websiteInfos;
    }

    @Override
    public List<WebsiteInfo> findList(int startNd, int endNd) {
        List<WebsiteInfo> websiteInfos = websiteInfoMapper.selectList(startNd, endNd);
        for(WebsiteInfo info : websiteInfos){
            info.setHaswebsite("1");
        }
        return websiteInfos;
    }
}
